package com.qianji.controller;

import com.qianji.pojo.PVUVDto;
import com.qianji.service.PVUVLeaveService;
import com.qianji.service.PVUVService;
import com.qianji.utils.Result;
import com.qianji.vo.PVUV;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/leave/")
public class PVUVLeaveController {

    @Autowired
    private PVUVLeaveService pvuvService;

/*    @ApiOperation("新增PV")
    @RequestMapping(value = "pv", method = RequestMethod.POST)
    public void addPV(@RequestBody PVUV pvuv){
        for (PVUVDto pvuvDto:pvuv.getData().getList()) {

            log.info("leave PV 入参：{}",pvuvDto);

            pvuvService.addPV(pvuvDto);
        }
    }*/

    @ApiOperation("新增UV PV")
    @RequestMapping(value = "uv", method = RequestMethod.POST)
    public void addUV(@RequestBody PVUV pvuv){
        for (PVUVDto pvuvDto:pvuv.getData().getList()) {

            log.info("leave UV 入参：{}",pvuvDto);
            pvuvService.addPV(pvuvDto);
            pvuvService.addUV(pvuvDto);
        }
    }


}
